#include<bits/stdc++.h>

using namespace std;
const int maxn = 1e6 + 10;
int dp[maxn];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        if (i == 1 || i == 2 || i == 4 || i == 5 || i == 10)dp[i] = 1;//i是货币单位，只需要1个
        else dp[i] = i;//i元，总可以用i个1元硬币兑换
    }
    for (int i = 3; i <= n; i++) {
        if (i > 1) dp[i] = min(dp[i], 1 + dp[i - 1]);
        if (i > 2) dp[i] = min(dp[i], 1 + dp[i - 2]);
        if (i > 3) dp[i] = min(dp[i], 1 + dp[i - 4]);
        if (i > 5) dp[i] = min(dp[i], 1 + dp[i - 5]);
        if (i > 10) dp[i] = min(dp[i], 1 + dp[i - 10]);
    }

    cout << dp[n];

    return 0;
}
